<h1>Self Organizing Map prediction</h1>

<% 
unless @normalized_data == nil || @normalized_data.size <= 1
	classes = Array.new
	@normalized_data.each_index do |i| 
		id = @som.classify(@normalized_data[i]).first
		classes[id] = Array.new if classes[id] == nil
		classes[id] << @data_indexes[i]
	end
%>

<br/>
<% 
	while classes.index(nil)!= nil
		classes.delete_at(classes.index(nil))
	end
	
	classes.sort!{|x,y| x.size <=>y.size } 
	similiar = classes.select{|x| x.include?(0)} 
	classes.delete_at(-1) # delete more populate class
%>
<br/>

<% 	unless similiar.empty? %>
Faulty communication and looks like correct one:

<% similiar.each do|t| 
	t.each do |c|
%>
<%= link_to_remote c.to_s,
							{:url => { :controller => :output_analyzer, :action => :get_testcase_list, :output => @simulation_selected, :testcase_id => c}, 
							:before => "loading('testcase_menu')",
							:update => "testcase_menu"} %> 
<% 		end
	end 
	classes.delete_if{|x| x.include?(0)} 
end %>

<br/>
<%
unless classes.empty?  %>

Faulty communication with strange value:

<% classes.each do |t| 
	t.each do |c| %>
	
<%= link_to_remote c.to_s,
							{:url => { :controller => :output_analyzer, :action => :get_testcase_list, :output => @simulation_selected, :testcase_id => c}, 
							:before => "loading('testcase_menu')",
							:update => "testcase_menu"} %> 

<% 		end
	end 
end

else # unless @normalized_data
%>
No enough data to perform SOM analysis
<%
end
%>
<br/>
